{% load debate_tags static i18n cache %}
{% get_current_language as LANGUAGE_CODE %}

{% cache 600 footer tournament LANGUAGE_CODE %}
<div class="row mt-3">

  <div class="navbar navbar-light container-fluid small">

    <div class="row mt-3 mb-2">

      <div class="col-lg-6 col-md-5">
        <h6 class="d-inline-block">
          {% if tournament and tabbycat_codename %}
            {% blocktrans trimmed %}{{ tournament }} runs on Tabbycat {{ tabbycat_version }} ({{ tabbycat_codename }}) {% endblocktrans %}
          {% else %}
            {% blocktrans trimmed %}This site runs on Tabbycat {{ tabbycat_version }} ({{ tabbycat_codename }}) {% endblocktrans %}
          {% endif %}
        </h6>
        <p class="text-muted">
          {% blocktrans trimmed %}
            Tabbycat is a source-available project developed by volunteers, and is free to use for tabbing non-profit, non-fundraising tournaments.
          {% endblocktrans %}
          {% if tournament and tournament.billable_teams > 0 %}
            {% blocktrans trimmed with amount=tournament.billable_teams %}
              For a tournament of this size, we suggest <a href="https://opencollective.com/tabbycat/contribute/licensing-29466/checkout?amount={{ amount }}">a donation of <strong>${{ amount }}</strong></a>.
            {% endblocktrans %}
            <a href="https://opencollective.com/tabbycat">
              {% trans "Learn more about donating." %}
            </a>
          {% else %}
            {% blocktrans trimmed %}
              <a href="https://opencollective.com/tabbycat">Donations to Tabbycat from individuals or organisations</a> are much appreciated.
            {% endblocktrans %}
          {% endif %}
        </p>
      </div>

      <div class="col-lg-4 col-md-4 mt-2 mt-md-0">
        <h6 class="d-inline-block">{% blocktrans trimmed %}Still timing debates with the stopwatch app?{% endblocktrans %}</h6>
        <p class="text-muted">
          {% blocktrans trimmed %}
            Using an app designed for debate timekeeping makes speaking and adjudicating easier!
            Check out <a href="https://itunes.apple.com/app/apple-store/id1156065589?pt=814172&ct=Tabbycat%20Installs&mt=8">Timekept</a> (iPhone/iPad)
            or <a href="https://play.google.com/store/apps/details?id=net.czlee.debatekeeper&referrer=utm_source%3Dtabbycat%26utm_medium%3Dfooter">Debatekeeper</a> (Android).
          {% endblocktrans %}
        </p>
      </div>

      <div class="col-lg-2 col-md-3 mt-2 mt-md-0">
        <h6 class="d-inline-block">{% blocktrans trimmed %}Our Organisation{% endblocktrans %}</h6>
        <p class="text-muted">
          {% blocktrans trimmed %}
            Tabbycat is supported by the <a href="http://tabbycat-debate.org/">Tabbycat Debate Association</a>, a non-profit for advancing open debate technology.
          {% endblocktrans %}
        </p>
      </div>

     <div class="w-100"></div>

      <div class="col mt-2">
        <ul class="nav justify-content-center">
          <li class="nav-item p-2">
            <i data-feather="globe"></i>
            <a class="nav-link p-0 d-inline-block" href="#" data-toggle="modal" data-target="#setLanguageModal">
              {% trans "Language" as local_language_label %}
              Language {% if LANGUAGE_CODE != 'en' and local_language_label != "Language" %} / {{ local_language_label }}{% endif %}
            </a>
          </li>
          <li class="nav-item p-2">
            <i data-feather="github"></i>
            <a class="nav-link p-0 d-inline-block" href="https://github.com/TabbycatDebate/tabbycat/">
              {% trans "GitHub" %}
            </a>
          </li>
          <li class="nav-item p-2">
            <i data-feather="book"></i>
            <a class="nav-link p-0 d-inline-block" href="http://tabbycat.readthedocs.io/en/stable/">
              {% trans "Documentation" %}
            </a>
          </li>
          <li class="nav-item p-2">
            <i data-feather="help-circle"></i>
            <a class="nav-link p-0 d-inline-block" href="http://tabbycat.readthedocs.io/en/stable/about/support.html">
              {% trans "Support" %}
            </a>
          </li>
          <li class="nav-item p-2">
            <i data-feather="facebook"></i>
            <a class="nav-link p-0 d-inline-block" href="https://www.facebook.com/TabbycatDebate/">
              {% trans "Facebook" %}
            </a>
          </li>
          <li class="nav-item p-2">
            <i data-feather="upload-cloud"></i>
            <a class="nav-link p-0 d-inline-block" href="https://github.com/TabbycatDebate/tabbycat#%EF%B8%8F-installation">
              {% trans "Set Up A Copy" %}
            </a>
          </li>
        </ul>
      </div>
    </div>

  </div>
</div>

<div class="modal fade" id="setLanguageModal" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">{% trans "Change Language" %}</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form action="{% url 'set_language' %}" method="post">{% csrf_token %}
          <input name="next" type="hidden" value="{{ redirect_to }}">
          <select name="language" class="custom-select">
              {% get_available_languages as LANGUAGES %}
              {% get_language_info_list for LANGUAGES as languages %}
              {% for language in languages %}
                <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
                  {{ language.name_local }} ({{ language.code }})
                </option>
              {% endfor %}
          </select>
          <input class="btn btn-primary btn-block mt-3" type="submit" value="{% trans "Use this language" %}">
        </form>
      </div>
    </div>
  </div>
</div>
{% endcache %}
